home *** CD-ROM | disk | FTP | other *** search
- /* Unterprogramme für ShowPicasso
- ** File: tools.c
- */
-
-
- #include "sp_tools.h"
-
-
- /* Umwandlung eines String in LONG */
-
- LONG stol(UBYTE *str)
- {
- LONG i=NULL,j=strlen(str),l=NULL;
-
- if(!str) return(NULL);
-
- while((i < j) && (str[i] > 47) && (str[i] < 58))
- {
- l += (str[i] - 48);
- l *= 10;
- i++;
- }
-
- return(l / 10);
- }
-
- /* Ausgabe von Programmeldungen */
-
- VOID OutText(UBYTE *str)
- {
- if(USERFLGS & PFLG_WBSTART)
- {
- msgreq.es_TextFormat = str;
- EasyRequest(NULL,&msgreq,NULL,NULL);
- /* rtEZRequestA( str, "Ok", NULL, NULL, NULL); */
- }
- else VPrintf("%s\n",&str);
- }
-
-
- /* Öffnen der benötigten Libraries */
-
-
- BOOL OpenLibs(void)
- {
- if(!(IntuitionBase = OpenLibrary("intuition.library",LIBRARY_MIN))) return(FALSE);
- if(!(IconBase = OpenLibrary("icon.library",LIBRARY_MIN))) return(FALSE);
- if(!(WorkbenchBase = OpenLibrary("workbench.library",LIBRARY_MIN))) return(FALSE);
- if(!(AslBase = OpenLibrary("asl.library",LIBRARY_MIN))) return(FALSE);
- if(!(GfxBase = OpenLibrary("graphics.library",LIBRARY_MIN))) return(FALSE);
- if(!(IFFParseBase = OpenLibrary("iffparse.library",LIBRARY_MIN))) return(FALSE);
- if(!(VilIntuiBase = OpenLibrary("vilintuisup.library",0))) return(FALSE);
- /* if(!(ReqToolsBase = OpenLibrary("reqtools.library",38L))) return(FALSE); */
- LocaleBase = OpenLibrary("locale.library",38L);
- return(TRUE);
- }
-
-
- /* Schließen der Libraries */
-
-
- void CloseLibs(void)
- {
- if(IntuitionBase) CloseLibrary(IntuitionBase);
- if(IconBase) CloseLibrary(IconBase);
- if(WorkbenchBase) CloseLibrary(WorkbenchBase);
- if(AslBase) CloseLibrary(AslBase);
- if(GfxBase) CloseLibrary(GfxBase);
- if(IFFParseBase) CloseLibrary(IFFParseBase);
- if(VilIntuiBase) CloseLibrary(VilIntuiBase);
- /* if(ReqToolsBase) CloseLibrary(ReqToolsBase); */
- if(LocaleBase) CloseLibrary(LocaleBase);
- }
-
-
- /* Speicherreservierung */
-
-
- BOOL GetWorkSpace(VOID)
- {
- ULONG workspace = cbufsize + 852L; /* (ULONG)sizeof(BitMapHeader) + 768L + 64L */
-
- if(cbuf = AllocVec(workspace,MEMF_PUBLIC|MEMF_CLEAR))
- {
- color = cbuf + cbufsize;
- bmhd = (BitMapHeader *)(color + 768L); /* 256 * 3 (r,g,b) = 768 */
- mynamebuffer = (UBYTE *)(bmhd + 20L); /* (ULONG)sizeof(BitMapHeader) */
- return(TRUE);
- }
- return(FALSE);
- }
-
-
- /* Freigabe des Speichers */
-
-
- VOID FreeWorkSpace(VOID)
- {
- if(cbuf) FreeVec(cbuf);
- }
-